﻿function init() {
    jQuery('#ddlCateLevel1,#ddlCateLevel2,#txtLinkInput,#ddlModalCateLevel2,#ddlModalCateLevel1').attr('disabled', true);
}

function switchstate_dm1() {
    var n = jQuery("#ckb_dm1:checked").length;
    //ckb_dm1 is checked
    if (n == 1)
        jQuery('#ddlCateLevel1').attr('disabled', false); 
    else if(n == 0) //ckb_dm1 is unchecked
        jQuery('#ddlCateLevel1').attr('disabled', true);
}

function switchstate_dm2() {
    var n = jQuery("#ckb_dm2:checked").length;
    //ckb_dm1 is checked
    if (n == 1)
        jQuery('#ddlCateLevel2').attr('disabled', false);
    else if (n == 0) //ckb_dm1 is unchecked
        jQuery('#ddlCateLevel2').attr('disabled', true);
}


function switchstate_modal_dm1() {
    var n = jQuery("#ckb_modal_dm1:checked").length;
    //ckb_dm1 is checked
    if (n == 1)
        jQuery('#ddlModalCateLevel1').attr('disabled', false);
    else if (n == 0) //ckb_dm1 is unchecked
        jQuery('#ddlModalCateLevel1').attr('disabled', true);
}

function switchstate_modal_dm2() {
    var n = jQuery("#ckb_modal_dm2:checked").length;
    //ckb_dm1 is checked
    if (n == 1)
        jQuery('#ddlModalCateLevel2').attr('disabled', false);
    else if (n == 0) //ckb_dm1 is unchecked
        jQuery('#ddlModalCateLevel2').attr('disabled', true);
}

function switchstate_link() {

    var n = jQuery("#ckbLink:checked").length;
    //ckb_dm1 is checked
    if (n == 1)
        jQuery('#txtLinkInput').attr('disabled', false);
    else if (n == 0) //ckb_dm1 is unchecked
        jQuery('#txtLinkInput').attr('disabled', true);
}